﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Linq;
using System.Text;

namespace LambdaToSql.DbHelper
{
    public interface IDBhelper
    {
        #region IDataReader

        /// <summary>
        /// 返回IDataReader
        /// </summary>
        /// <param name="sqlStr">sql语句</param>
        /// <param name="parameter">object参数数组</param>
        /// <returns>返回IDataReader</returns>
        IDataReader ExecuteReader(string sqlStr, object parameter = null);

        /// <summary>
        /// 返回 IDataReader
        /// </summary>
        /// <param name="sqlStr">sql语句</param>
        /// <param name="parameters">object参数数组</param>
        /// <returns>返回值 IDataReader类型的参数</returns>
        IDataReader ExecuteReader(string sqlStr, object[] parameters);

        #endregion IDataReader

        #region DataTable

        /// <summary>
        /// 返回 DataTable
        /// </summary>
        /// <param name="sqlStr">sql语句</param>
        /// <param name="parameter">object参数数组</param>
        /// <returns>返回值 DataTable类型的参数</returns>
        DataTable ExecuteTable(string sqlStr, object parameter = null);

        /// <summary>
        /// 返回 DataTable
        /// </summary>
        /// <param name="sqlStr">sql语句</param>
        /// <param name="parameters">object参数数组</param>
        /// <returns>返回值 DataTable类型的参数</returns>
        DataTable ExecuteTable(string sqlStr, object[] parameters);

        #endregion

        #region ExecuteScalar

        /// <summary>
        /// 返回 object
        /// </summary>
        /// <param name="sqlStr">sql语句</param>
        /// <param name="parameter">object参数数组</param>
        /// <returns>返回值 int类型的参数</returns>
        string ExecuteScalar(string sqlStr, object parameter = null);

        /// <summary>
        /// 返回 object
        /// </summary>
        /// <param name="sqlStr">sql语句</param>
        /// <param name="parameters">object参数数组</param>
        /// <returns>返回值 int类型的参数</returns>
        string ExecuteScalar(string sqlStr, object[] parameters);

        #endregion ExecuteScalar

        #region ExecuteScalars

        /// <summary>
        /// 返回查询的第一个字段值 返回Ilist集合
        /// </summary>
        /// <param name="sqlStr">sql语句</param>
        /// <param name="parameter">参数列表</param>
        /// <returns></returns>
        IList<string> ExecuteScalars(string sqlStr, object parameter = null);

        /// <summary>
        /// 返回查询的第一个字段值 返回Ilist集合
        /// </summary>
        /// <param name="sqlStr">sql语句</param>
        /// <param name="parameters">参数列表</param>
        /// <returns></returns>
        IList<string> ExecuteScalars(string sqlStr, object[] parameters);

        #endregion ExecuteScalars

        #region ExecuteNonQuery

        /// <summary>
        /// 执行ExecuteNonQuery
        /// </summary>
        /// <param name="sqlStr">sql语句</param>
        /// <param name="parameter">object参数数组</param>
        /// <returns>返回值 int类型的参数</returns>
        int ExecuteNonQuery(string sqlStr, object parameter = null);

        /// <summary>
        /// 执行 ExecuteNonQuery
        /// </summary>
        /// <param name="sqlStr">sql语句</param>
        /// <param name="parameters">object参数数组</param>
        /// <returns>返回值 int类型的参数</returns>
        int ExecuteNonQuery(string sqlStr, object[] parameters);

        #endregion ExecuteNonQuery   
    }
}
